Skip to content

bpo-36043: FileCookieJar supports os.PathLike #11945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 1, 2019

Conversation

matrixise
Copy link
Member

@matrixise matrixise commented Feb 19, 2019

Copy link
Member

@tirkarthi tirkarthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

@matrixise
Copy link
Member Author

@tirkarthi done, could you review again? thanks

@@ -341,6 +345,9 @@ writing.
compatible with the libwww-perl library's ``Set-Cookie3`` file format. This is
convenient if you want to store cookies in a human-readable file.

.. versionchanged:: 3.8

The filename parameter supports a :class:`~pathlib.Path` instance.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted below this can be anything that implements fspath and not only pathlib.Path instance. Please use path-like object term with markup (:term:path-like object)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -71,6 +71,10 @@ The following classes are provided:
:meth:`load` or :meth:`revert` method is called. Subclasses of this class are
documented in section :ref:`file-cookie-jar-classes`.

.. versionchanged:: 3.8

The filename parameter supports a :class:`~pathlib.Path` instance.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use path-like object as below

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Copy link
Member

@tirkarthi tirkarthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks 👍

@JulienPalard
Copy link
Member

Out of curiosity, why inverting the if and the try? It just make the diff bigger from my point of view.

@matrixise
Copy link
Member Author

@JulienPalard good catch, thank you, just updated with your recommendation.

@matrixise
Copy link
Member Author

Because I stopped to raise an ValueError, I suppose I should update the documentation and indicate that we raise a TypeError

filename = test.support.TESTFN
c = LWPCookieJar(filename)
self.assertEqual(c.filename, filename)
self.assertIsInstance(c.filename, str)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the type checks necessary? Unless the docs explicitly state that then I don't think they are necessary.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, they are not necessary, I have removed them. Thank you for your review.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be poked with soft cushions!

@matrixise matrixise changed the title bpo-36043: FileCookieJar supports pathlib.Path bpo-36043: FileCookieJar supports os.PathLike Feb 21, 2019
@matrixise
Copy link
Member Author

@brettcannon if you want to continue your review, thank you.

@brettcannon
Copy link
Member

@matrixise you forgot to ask Bedevere to mark this as ready to be reviewed again. 😄 Otherwise it doesn't end up in my review queue.

@matrixise
Copy link
Member Author

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@brettcannon: please review the changes made to this pull request.

@matrixise
Copy link
Member Author

useful this very small sentence for @bedevere-bot ;-)

@brettcannon
Copy link
Member

@matrixise thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants